package com.tuling.netty.splitpacket;

import io.lettuce.core.ScriptOutputType;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class MyMessageEncode extends MessageToByteEncoder<MyMessagePropol> {
    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, MyMessagePropol myMessagePropol, ByteBuf byteBuf) throws Exception {
        System.out.println("MyMessageEncode  方法被调用" + new String(myMessagePropol.getContent()));
        byteBuf.writeInt(myMessagePropol.getLen());

        byteBuf.writeBytes(myMessagePropol.getContent());
    }
}
